<?php
/**
 * Created by PhpStorm.
 * User: 小灰灰
 * Date: 2022-04-22
 * Time: 14:10:35
 * Info:
 */

namespace app\common\model;

class LoginLog extends Common
{

    public static function addRecord($loginDevice)
    {
        if (empty($loginDevice)) {
            return false;
        }

        $update               = [];
        $update['user_id']    = $loginDevice['user_id'] ?: 0;
        $update['user_name']  = $loginDevice['user_name'] ?: '';
        $update['ip_address'] = $loginDevice['ip_address'] ?: '';
        $update['country']    = $loginDevice['country'] ?: '';
        $update['area']       = $loginDevice['area'] ?: '';
        $update['city']       = $loginDevice['city'] ?: '';
        $update['isp']        = $loginDevice['isp'] ?: '';
        $update['desc']       = $loginDevice['desc'] ?: '';

        self::create($update);

        return true;
    }

}